Next: Error recovery, Previous: Actions goodies, Up: Wisent Parsing [Contents][Index]
When the parser encounters a syntax error it calls a user-defined function. It must be an Emacs Lisp function with one argument: a string containing the message to report.
By default the parser uses this function to report error messages:
Print a one-line message if
wisent-parse-verbose-flag is set. Pass
string and args arguments to
message.
wisent-message uses the following function to
print lexical tokens:
Return a printed representation of lexical token token.
The general printed form of a lexical token is:
token(value)@location
To control the verbosity of the parser you can set to
non-nil this variable:
non-nil means to issue more messages while
parsing.
Or interactively use the command:
Toggle whether to issue more messages while parsing.
When the error reporting function is entered the variable
wisent-input contains the unexpected token as
returned by the lexer.
The error reporting function can be called from a semantic
action too using the special macro wisent-error.
When called from a semantic action entered by error recovery (see
Error recovery)
the value of the variable wisent-recovering is
non-nil.